#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "middle.h"
#include<QPushButton>
#include<QMessageBox>
#include<QString>
#include<QDebug>
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    connect(ui->pushButton_5,&QPushButton::clicked,this,&MainWindow::close);
    setweight();
    on_login_clicked();


}
void MainWindow::on_login_clicked()
{
    QString user,password;
    user=ui->lineEdit->text();
    password=ui->lineEdit_2->text();


            connect(ui->login,&QPushButton::clicked,[=](){
                QMessageBox::information(this,"提示","登录成功");
                this->close();
                Middle * p = new Middle();
                p->show();
            });





    return;
}


void MainWindow::setweight()
{
    setAutoFillBackground(true);    // 这句要加上, 否则可能显示不出背景图.
       QPalette palette = this->palette();
       //palette.setColor(QPalette::Window, Qt::red);  // 设置背景色
       //palette.setBrush(this->backgroundRole(), Qt::black);// 设置背景色
       palette.setBrush(QPalette::Window,
               QBrush(QPixmap(":/image/imagesys/zongyi4.png").scaled(    // 缩放背景图.
                   this->size(),
                   Qt::IgnoreAspectRatio,
                   Qt::SmoothTransformation)));    // 使用平滑的缩放方式
       this->setPalette(palette);
}

MainWindow::~MainWindow()
{
    delete ui;
}


